From: Florian Müllner Date: Mon, 19 Aug 2019 19:18:54 +0000 (+0200) Subject: magnifier: Do not modify function argument X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~811^2^2~71 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=8d6820c4df413eb51d1323a52e1d2212640777f2;p=gnome-shell.git magnifier: Do not modify function argument The intention of the code is clearly to operate on a copy, but that's not how the Object constructor works. While it doesn't matter in practice that we modify the passed-in object parameter, it's still a good idea to fix the code. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/731 --- diff --git a/js/ui/magnifier.js b/js/ui/magnifier.js index 73522586f..0ec30ee00 100644 --- a/js/ui/magnifier.js +++ b/js/ui/magnifier.js @@ -264,7 +264,7 @@ var Magnifier = class Magnifier { zoomRegion.setViewPort(viewPort); // We ignore the redundant width/height on the ROI - let fixedROI = new Object(roi); + let fixedROI = Object.create(roi); fixedROI.width = viewPort.width / xMagFactor; fixedROI.height = viewPort.height / yMagFactor; zoomRegion.setROI(fixedROI);